proc format;
value AgeGrpf 	
	1="18-24" 
	2="25-44" 
	3="45-64" 
	4="65+";
value sexf 
	1='male' 
	2='female' ;
value race_ethnf 
	1='NH White' 
	2='NH BAA' 
	3='NH AIAN'
    4='NH Asian' 
	5='NH HPI' 
	6='NH Mult' 
	7='Hisp';
value race_ethn4f 
	1='NH White' 
	2='NH BAA' 
	4='NH OTHER:AIAN,ASIAN,HPI,MULT' 
	7='Hisp' ;

Value EducF
		1 = "Less than High School"
		2 = "High School (or equivalent)"
		3 = "Some College or Bachelor�s Degree"
		4 = "Graduate degree";
value newemplstatf
    1='Employed: at work/not at work/absent'
    2='Unemployed: on layoff/looking for work'
    3='Not in labor force'
;
value incomef
    1='<$20,000'
    2='$20,000-39,999'
    3='$40,000-74,999'
    4='$75,000+'
;
value marriedF 
		1 = "Married (Spouse present or absent)"
		2 = "widowed, divorced, or separated"
		3 = "Never married";
value GEREGf
1='Northeast'
2='Midwest'
3='South'
4='West'
;
value metrof
    1='Metropolitan'
    2='Non-Metropolitan'
	3='Not identified';
value phone1F
		1 = "Phone"
		2 = "Personal";
run;


/*dataset compl limits to respondents with complete info on all study measures
as well as ever use of each tobacco product*/
/* The data set COMPL has 107281 observations and 181 variables*/

/*Variables used in the study: 
Age group: AgeGrp 
Sex: PESex 
Race/ethnicity: race_ethn4 race_ethn 
Marital status: marstat 
Educaiton: educ 
Employment status: NewEMPLSTAT 
Income: income 
Region: GEREG 
Mtropolitan area: metro 
Survey mode: Phone1 

For the current use indicators below: 1=YES, 0=NO 

Current use of ...
	Nicotine pouches: nicpouch_curr1 
	Cigars: cigar_curr1 
	Regular cigarettes: smok_curr1 
	E-cigarettes: ecig_curr1 
	Heated tobacco: heated_curr1 
	Hookah tobacco: hookah_curr1 
	Regular pipes: pipe_curr1 
	Smokeless tobacco: smless_curr1 
	At least one tobacco product (out of these 7): atleastone1

Survey weights: PWSRWgt RepWgt1--RepWgt160
*/ 


/*FULL SAMPLE: n=107,281 Table 1*/
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Table AgeGrp PESex race_ethn4 race_ethn ;
Weight PWSRWgt; RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Table marstat educ NewEMPLSTAT income ;
Weight PWSRWgt; RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Table GEREG metro Phone1 /*MV=331*/ ;
Weight PWSRWgt; RepWeights RepWgt1-RepWgt160;
Run; 
/*FULL SAMPLE: n=107,281 Table 2*/
/*CHI-SQUARE TESTS*/
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables cigar_curr1*nicpouch_curr1 /chisq col row ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables smok_curr1*nicpouch_curr1/chisq col row ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables ecig_curr1*nicpouch_curr1 /chisq col row ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables heated_curr1*nicpouch_curr1/chisq col row ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables hookah_curr1*nicpouch_curr1 /chisq row ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables  pipe_curr1*nicpouch_curr1 
		smless_curr1*nicpouch_curr1 /chisq row ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables atleastone1*nicpouch_curr1/chisq row ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
/*Table 3 footnote*/
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables race_ethn*nicpouch_curr1;
Weight PWSRWgt;
RepWeights RepWgt1-RepWgt160;
Run; 
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables metro*nicpouch_curr1;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 

/*MODEL-ASSISTED ANALYSIS, TABLE 3*/
/*Survey mode is not significantly associated with current use of pouches*/
Proc SurveyFreq Data=compl VarMethod=BRR (Fay=0.5);
Tables phone1*nicpouch_curr1/chisq col row;
Weight PWSRWgt; RepWeights RepWgt1-RepWgt160;Run; 

/*binary metropolitan status: metro1*/
data model; set compl; if metro=1 then metro1=1; if metro in (2,3) then metro1=2;run;
/*If a ridging warning occurs, it is likely related to the local computing environment 
   (e.g., software configuration, available memory, or SAS version) rather than to 
   the model specification. This issue may arise when analyzing very large samples.*/
/*final model, alpha=0.05*/
PROC SURVEYLOGISTIC data=model VarMethod=BRR(Fay=0.5) ; 
class AgeGrp PESex(REF="female") race_ethn4(REF="NH White")  
	  educ(REF="Graduate degree") NewEMPLSTAT(REF=FIRST)
	  income(REF="$75,000+") marstat(REF="Never married") 
	  metro1(REF=LAST) GEREG(REF="Northeast")   
        smok_curr1(REF=FIRST) hookah_curr1(REF=FIRST) 
		ecig_curr1(REF=FIRST) pipe_curr1(REF=FIRST)  
		smless_curr1(REF=FIRST) heated_curr1(REF=FIRST)  
		cigar_curr1(REF=FIRST)  
	  /param=glm;
model nicpouch_curr1(REF=FIRST)= cigar_curr1 smok_curr1 ecig_curr1 heated_curr1
								 hookah_curr1 pipe_curr1 smless_curr1 
 								 AgeGrp PESex race_ethn4 Educ NewEMPLSTAT income marstat metro1 GEREG 
								 /rsq ;  
Weight PWSRWgt; RepWeights RepWgt1-RepWgt160;Run; 
/*Bonferroni adjustments*/
PROC SURVEYLOGISTIC data=model VarMethod=BRR(Fay=0.5); 
class AgeGrp PESex(REF="female") race_ethn4(REF="NH White")  
	  educ(REF="Graduate degree") NewEMPLSTAT(REF=FIRST)
	  income(REF="$75,000+") marstat(REF="Never married") 
	  metro1(REF=LAST) GEREG(REF="Northeast")   
        smok_curr1(REF=FIRST) hookah_curr1(REF=FIRST) 
		ecig_curr1(REF=FIRST) pipe_curr1(REF=FIRST)  
		smless_curr1(REF=FIRST) heated_curr1(REF=FIRST)  
		cigar_curr1(REF=FIRST)  
	  /param=glm;
model nicpouch_curr1(REF=FIRST)= cigar_curr1 smok_curr1 ecig_curr1 heated_curr1
								 hookah_curr1 pipe_curr1 smless_curr1 
 								 AgeGrp PESex race_ethn4 Educ NewEMPLSTAT income marstat metro1 GEREG 
								 /alpha=0.01667 ;  
Weight PWSRWgt; RepWeights RepWgt1-RepWgt160;Run; 

/*SECONDARY GOAL, n=537*/
data user; set compl; if nicpouch_curr1=1; run;
/*Table 4: tobacco use among adults who currently use nicotine pouches*/
Proc SurveyFreq Data=user VarMethod=BRR (Fay=0.5);
Tables cigar_curr1 smok_curr1 ecig_curr1 heated_curr1
hookah_curr1 pipe_curr1 smless_curr1 atleastone1;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
/*Sociodemographic characteristics of adults who currently use nicotine pouches*/ 
Proc SurveyFreq Data=user VarMethod=BRR (Fay=0.5);
Tables AgeGrp PESex race_ethn race_ethn4 educ 
NewEMPLSTAT income marstat metro GEREG ;
Weight PWSRWgt;RepWeights RepWgt1-RepWgt160;
Run; 
/*END OF CODE*/
